const util = require("../../utils/util.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    mid: 0,
    pid: 0,
    sellData: [],
    users: wx.getStorageSync('USERS')
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.setData({
      mid: options.mid,
      pid: options.pid
    });
    if (!that.data.users.id) {
      that.setData({
        users: wx.getStorageSync('USERS')
      });
    }
    util.wxGet({
      url: "/rest/readGridsLogs", params: { "uid": that.data.users.id, "mid": that.data.mid, "pid": that.data.pid },
      success: function (data) {
        that.setData({
          sellData: data.data.data
        });
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    var that = this;
    util.wxGet({
      url: "/rest/readGridsLogs", params: { "uid": that.data.users.id, "mid": that.data.mid, "pid": that.data.pid },
      success: function (data) {
        that.setData({
          sellData: data.data.data
        });
        wx.stopPullDownRefresh();
      }
    });
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})